<template>
  <div class="content">
    <p style="font-weight: 600">
      <slot name="listtitle">{{title}}</slot>
    </p>
    <div class="recommend">
      <ul>
        <li
          class="item border-bottom"
          v-for="(item,key) in list"
          :key="key"
          @click="$emit('link-to',{vid: item.vid, type: item.data_type})"
        >
          <span class="item-imgandp">
            <img class="item-img" :src="item.picture">
            <p v-if="item.data_type == 2">专栏</p>
            <p v-if="item.data_type == 1">视频</p>
            <p v-if="item.data_type == 3">图文</p>
          </span>
          <div class="item-info">
            <p class="item-title">{{item.title}}</p>
            <p class="item-desc">{{item.detail}}</p>
            <div class="item-info__ft">
              <span class="item-info__num">
                {{item.open}}
                <slot name="see">人开通</slot>
              </span>
              <slot name="price">
                <span class="item-price" v-if="item.shop_price">
                  <span class="item-price__discounts">
                    <span class="yen">&yen;</span>
                    <strong>{{item.market_price}}</strong>
                  </span>
                  <span class="item-price__original">
                    <del>{{item.shop_price}}</del>
                  </span>
                </span>
              </slot>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ProductsList',
  props: {
    list: {
      type: Array
    },
    title: {
      type: String
    },
    numUnit: {
      type: String
    },
    url: {
      type: String | Object,
      default: ''
    },
    title:{
      type:String,
      default: ""
    }
  },
  methods: {
  }
}
</script>

<style lang="less" scoped>
  .content {
    box-sizing: border-box;
    padding: 15px;
    padding-bottom: 0;
    background-color: #fff;
  }
  .item-imgandp {
    position: relative;
    width: 130px;
    height: 85px;
    p {
      position: absolute;
      bottom: 0;
      width: 100%;
      text-align: right;
      font-size: 14px;
      background: linear-gradient(#908080, black);
      opacity: 0.3;
      color: white;
    }
  }
  .recommend {
    margin-top: 5px;
    position: relative;
    .item {
      overflow: hidden;
      display: flex;
      height: 100px;
      margin-top: 10px;
      &-img {
        width: 130px;
        height: 85px;
        object-fit: cover;
        border-radius: 5px;
        background-color: #ccc;
      }
      &-title {
        margin-bottom: 8px;
        line-height: 16px;
        font-size: 14px;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      &-desc {
        margin-bottom: 15px;
        font-size: 11px;
        line-height: 14px;
        color: #acacac;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      &-info {
        flex: 1;
        box-sizing: border-box;
        padding: 2px;
        margin-left: 10px;
        min-width: 0;
        &__num {
          font-size: 11px;
          line-height: 16px;
          color: #acacac;
        }
      }
      &-info__ft {
        display: flex;
        justify-content: space-between;
      }
      &-price {
        line-height: 16px;
        color: #acacac;
        .yen {
          font-size: 10px;
        }
        &__discounts {
          margin: 0 5px;
          font-size: 14px;
          color: #dc376d;
        }
        &__original {
          font-size: 10px;
        }
      }
    }
  }
</style>
